package com.example.mypra1.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.mypra1.R;
import com.example.mypra1.adapter.entity.Comment;
import com.example.mypra1.adapter.entity.Reply;
import com.ldoublem.thumbUplib.ThumbUpView;
import com.szysky.customize.siv.SImageView;
import java.util.List;

/**
 * 自定义帖子回复的列表适配器
 */
public  class ReplyListAdapter extends ArrayAdapter<Reply> {
    private int resourceId;

    public ReplyListAdapter(@NonNull Context context, int resourceId, @NonNull List<Reply> objects) {
        super(context, resourceId, objects);
        this.resourceId = resourceId;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        Reply reply = getItem(position);
        View view= LayoutInflater.from(getContext()).inflate(resourceId,null);
        SImageView profile = view.findViewById(R.id.rep_profile);
        TextView rep_username = view.findViewById(R.id.rep_username);
        TextView rep_content = view.findViewById(R.id.rep_content);
        profile.setImageUrls(reply.getProfile());
        rep_username.setText(reply.getRep_username());
        rep_content.setText(reply.getRep_content());
        return view;
    }



}
